package com.cml.dm.admin.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import lombok.Data;

import java.util.Date;

/**
 * 日志：组织、任务标识、版本、时间、类型（备份、恢复）、状态、undo、备份
 */
@Data
@TableName("dm_exe_logger")
public class DmExeLogger {
    @TableId(type = IdType.ASSIGN_ID)

    @JsonSerialize(using = ToStringSerializer.class)
    private Long id;

    private String orgId;

    @TableField(value="`task_ID`")
    private String taskID;

    @TableField(value="`version`")
    private Double version;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date exeTime;

    /**
     * 1 备份  2 恢复
     */
    private Integer exeType;

    /**
     * 执行状态 0未开始 1 进行中 2 完成 3异常
     */
    private Integer exeStatus;

    private String undoPath;

    private String backupPath;

    private String shardingColumn;

    public  Integer backup(){
        return 1;
    }

    public Integer recovery(){
        return 2;
    }


}
